# Contributor: Adam Thiede <me@adamthiede.com>
# Maintainer: Adam Thiede <me@adamthiede.com>
pkgname=varlink
pkgver=23
pkgrel=0
pkgdesc="Varlink C library and command-line tool"
url="https://github.com/varlink/libvarlink"
arch="all"
license="Apache-2.0"
makedepends="meson"
checkdepends="bash"
subpackages="$pkgname-dev libvarlink:libs $pkgname-bash-completion $pkgname-vim::noarch"
source="https://github.com/varlink/libvarlink/archive/$pkgver/varlink-$pkgver.tar.gz"
builddir="$srcdir/libvarlink-$pkgver"

# tests fail on ppc64le
# upstream issue: https://github.com/varlink/libvarlink/issues/63
case "$CARCH" in
ppc64le*) options="$options !check" ;;
esac

build() {
	abuild-meson . output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

vim() {
	pkgdesc="$pkgdesc (vim syntax)"
	install_if="vim $pkgname=$pkgver-r$pkgrel"

	amove usr/share/vim
}

sha512sums="
b118ec9142ee73fe8fd53d5439f19a29013157a339da5bdcbfad2892d450486a1d8200b23101a5ffe15c80f78c90c6d4ce3bc605074bfdee15de8775b1135b5b  varlink-23.tar.gz
"
